Reuse clean_taxon_name in metatraits_gtdb CURIE construction#576
Merged
Conversation
metatraits_gtdb built its GTDB CURIEs with an inline `.replace(" ", "_")`
at both construction sites (synthetic node id and subClassOf target),
duplicating the canonical logic in gtdb/utils.clean_taxon_name. Import and
reuse it so the two transforms cannot drift if the canonical cleaner ever
changes. Behaviour is identical (clean_taxon_name is the same space->
underscore replacement); the prefix-stripping lookup-map code is unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tidy-up:
metatraits_gtdbbuilt its GTDB CURIEs with an inline.replace(" ", "_")at both construction sites, duplicating the canonical logic ingtdb/utils.clean_taxon_name. This imports and reusesclean_taxon_nameso the two GTDB-emitting transforms (gtdbandmetatraits_gtdb) can't drift if the canonical cleaner ever changes.Change
clean_taxon_nameinmetatraits_gtdb.search_name.replace(" ", "_")→clean_taxon_name(search_name).current_species.replace(' ', '_')→clean_taxon_name(current_species).Behaviour-identical —
clean_taxon_nameis the same space→underscore replacement. The prefix-stripping lookup-map code (replace("s__", "")) is unrelated and left unchanged.Verification
ruff+codespellclean.tests/test_gtdb.py+tests/test_metatraits.py: 45 passed.gtdb/utils.pyhas no imports).🤖 Generated with Claude Code